package com.gieee.ywj.of;

import com.gieee.ywj.of.anno.EnableFeignClientByMe;
import com.gieee.ywj.of.rest.client.SayingRestService;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients(basePackages = {"com.gieee.ywj.of.feign"})
@EnableFeignClientByMe(clients = SayingRestService.class)
public class OFApplication {
    public static void main(String[] args) {
        new SpringApplicationBuilder(OFApplication.class)
                .web(WebApplicationType.SERVLET)
                .run(args);
    }

    @Bean
    @LoadBalanced
    public RestTemplate loadBalanced(){
        return new RestTemplate();
    }

}
